package util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTool {
     public static Date StringtoDate(String s) throws ParseException{
    	 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
    	 Date date=sdf.parse(s);
    	 return date;
     }
     public static String DatetoString(Date date) throws ParseException{
    	 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
    	 String s=sdf.format(date);
    	 return s;
     }
     
     public static java.sql.Date JavaDatetoSqlDate(java.util.Date date){
    	 java.sql.Date SqlDate=new java.sql.Date(date.getTime());
    	 return SqlDate;
     }
     public static java.util.Date SqlDatetoJavaDate(java.sql.Date date){
    	 java.util.Date JavaDate=new java.util.Date (date.getTime());
    	 return JavaDate;
     }
}
